//
//  DHFilterViewModel.m
//  精品酒店
//
//  Created by DIANGHONG on 2018/5/14.
//  Copyright © 2018年 DIANGHONG. All rights reserved.
//

#import "DHFilterViewModel.h"

@implementation DHFilterViewModel
- (void)loadAreaDataWithWithAreaModel:(DHAreaModel *)areaModel Completion:(void(^)(BOOL isSuccess, NSString *statusInfo))completion
{
    NSString *url = @"http://jpjd.cnaite.cn/mobile/index.php?act=index&op=getArea";
    
    NSMutableDictionary *params = [NSMutableDictionary dictionary];
    if (areaModel.area_id)
    {
        [params setObject:areaModel.area_id forKey:@"area_id"];
    }
    
    [DHNetworkManager.shareManager requestWithMethod:MethodGet
                                           UrlString:url
                                              params:params
                                          completion:^(id json, BOOL isSuccess)
     {
         if (!isSuccess) {
             completion(NO,@"网络有问题");
             return ;
         }
         if (!(json[@"datas"][@"list"])) {
             completion(true,@"服务器有问题");
             return;
         }
         self.areaList = [DHAreaList yy_modelWithJSON:json[@"datas"]];
         
         //[self.pickerView reloadData];
         completion(isSuccess,@"ok");
     }];
}
@end
